package org.zjx.command.basic;

import org.zjx.command.Command;
import org.zjx.core.GameWindow;

/**
 * 等待指令 - 不需要激活
 */
public class WaitCommand extends Command {
    private final long waitTimeMs;

    public WaitCommand(GameWindow window, long waitTimeMs) {
        super(window, false, "Wait[" + waitTimeMs + "ms]");
        this.waitTimeMs = waitTimeMs;
    }

    @Override
    protected void doExecute() {
        System.out.println("[Command] Waiting for " + waitTimeMs + "ms");
        try {
            Thread.sleep(waitTimeMs);
        } catch (InterruptedException e) {
            Thread.currentThread().interrupt();
            throw new RuntimeException("Wait command interrupted", e);
        }
    }
}